package creational.clone.deep;

import creational.clone.Citation;

import java.io.*;

public class Client {
    public static void main(String[] args) throws IOException {
        Citation citation = new Citation();
        citation.setName("张三");
        String url = "E:\\citation.txt";
        ObjectOutputStream objectOutputStream = null;
        ObjectInputStream objectInputStream = null;


        try {
            objectOutputStream = new ObjectOutputStream(new FileOutputStream(url));
            objectOutputStream.writeObject(citation);
            objectInputStream = new ObjectInputStream(new FileInputStream(url));
            Object o = objectInputStream.readObject();
            Citation c1 = (Citation) o;
            System.out.println(c1);
            System.out.println(c1 == citation);
        } catch (Exception e) {
        } finally {
            objectOutputStream.close();
        }

    }
}
